package com.jack.helloworld.adapter;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by Administrator on 2017/3/8.
 */
public class FragmentViewPageAdapter extends FragmentPagerAdapter {

    List<Fragment> listFragment;
    List<String> listViewPagerTitle;


    public FragmentViewPageAdapter(FragmentManager fm) {
        super(fm);
    }

    public FragmentViewPageAdapter(FragmentManager fm, List<Fragment> listFragment, List<String> listViewPagerTitle) {
        super(fm);
        this.listFragment = listFragment;
        this.listViewPagerTitle = listViewPagerTitle;
    }

    @Override
    public Fragment getItem(int position) {
        return listFragment.get(position);
    }

    @Override
    public int getCount() {
        return listFragment.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return listViewPagerTitle.get(position);
    }
}
